// 请求数据
let vjAjaxData = ({url, data, method, success,source}) => {
	// uni.showLoading({
	// 	title: "正在操作中..."
	// })
	if(!method) method = "GET";
	let header={
			"Terminalsource": "app",
			"token":uni.getStorageSync("token"),
			"CurrentOrgID":uni.getStorageSync("userLoginInfo") ? JSON.parse(uni.getStorageSync("userLoginInfo")).CurrentOrgID:0,
			"CurrentDepartmentID":uni.getStorageSync("userLoginInfo") ? JSON.parse(uni.getStorageSync("userLoginInfo")).CurrentDepartmentID:0,
			"CurrentLearningStageID":1
		};
	if(source){
		header.Terminalsource = source;
	}
	if(method == "POST"){
		let key = "content-type";
		let val = "application/x-www-form-urlencoded";
		header[key] = val;
	}
	uni.getNetworkType({
	    success: function (res) {
	        if(res.networkType!="none"){
				uni.request({
					url: url,
					data: data,
					method: method,
					header: header,
					success: success
				})
			}else{
				uni.showToast({
					icon:"none",
					title:"当前无网络，请稍候再试！",
					success: () => {
						
					}
				})
			}
	    }
	});
	
}

// 导出函数
export {
	vjAjaxData
}
